home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / QuidProNo! / Read Me or Die Horribly! < prev    next >
Text File  |  1996-06-23  |  14KB  |  199 lines

  1. /********** QuidProNo, written by J. Random Hacker at MacHack on 6/21/96
  2.  
  3.     A friend of mine, who couldn't make it to MacHack, and whose name I've mysteriously
  4.     forgotten actually sent me this hack and requested that I submit it for him.
  5.  
  6.     This extension simply installs global patch(es) to _Get1Resource and/or _GetResource
  7.     that redirects (re-types and/or re-numbers) a resource request to something else,
  8.     and then jumps to the pre-existing trap code.
  9.  
  10.     You can modify and add 'RSub' or 'RSb1' resources in the "redirect.rsrc" resource file
  11.     (or the compiled extension) to customize this for your own needs.  The
  12.     default behavior is to redirect 'inpr' 300 to 'inpr' 299.
  13.     Note: 'RSub' resources define patches to _GetResource, 'RSb1' hacks _Get1Resource
  14.     The format of these resources is 12 bytes: (ResEdit templates also in "redirect.rsrc")
  15.         4 bytes  <original ResType>
  16.         2 bytes  <original ResID>
  17.         4 bytes  <substituted ResType>
  18.         2 bytes  <substituted ResID>
  19.  
  20.     Example of use:
  21.  
  22.     1) Swap icon family resources -3993 and -3984 to make the trash appear empty when
  23.     full and vice versa.  Drop in the "trash confusion.rsrc" file and recompile to see
  24.     what this is all about.
  25.  
  26.     2) Redirect 'CURS' 6500 thru 6506 to map from 6506 down to 6500 to make the Finder's
  27.     watch spin backwards.  (Q: Why not modify the 'ACUR'? A: You'd have to create a
  28.     modified Finder.)
  29.  
  30.     3) Reverse (as in example 2 above) 'PICT' 11000 thru 11003 to make Finder progress bars
  31.     go backwards.
  32.  
  33.     4) Make applications unable to find resources by redirecting them to nonexistent ones.
  34.     A specific example, redirect 'inpr' 300 to 'inpr' 299 to make certain applications
  35.     unable to find boilerplate splash screen data.  This is the true "QuidProNo!"
  36.  
  37.     Warnings:
  38.  
  39.     1) This code may affect stuff other than what you intend - the patches are global,
  40.     so any program that uses redirected resource IDs will be affected.
  41.  
  42.     2) Don't run ResEdit while this (or derivatives of this) extension is loaded.  You
  43.     WILL become confused because you may be editing the wrong resources.
  44.  
  45.     Notes:
  46.  
  47.     1) If somebody objects to using this to disable legaleze, there's a solution provided
  48.     here: a legal boilerplate startup screen which you can drop into your system folder.
  49.  
  50.     2) You may have to define patch data for either or both Get1Resource and/or GetResource,
  51.     depending on how the software you're trying to mess with actually works.  If you
  52.     want to only apply the patches to certain processes, go ahead and change the source
  53.     code below... if it's a redirected patch, do additional checks before redirecting...
  54.  
  55.     3) In order to avoid undoing higher layer redirection when "swapping" things,
  56.     successful redirections jump to the same original trap code location.  (Unsuccessful
  57.     redirections (misses) keep following the patch chain.
  58.  
  59.     4) The patches are not fat.  This is left as an excercise to the hacker.  However,
  60.     be aware that some PPC code may not be affected (?) by 68K patches.
  61.  
  62.     5) You can create and load multiple flavors of QuidProNo!-based extensions, and each
  63.     extension can define multiple patches to Get1Resource and/or GetResource.
  64.  
  65.     6) If you install many redirections, you are installing many patches upon patches.
  66.     In pathelogical cases, performance may suffer, although _GetResource and _Get1Resource
  67.     probably aren't all that fast themselves.
  68.  
  69.     7) The code is based on some example skeleton in the CodeWarrior folder.
  70.  
  71.     8) Thanks to the T. Ç. and the Olive Gardeners for the perfect name.
  72.  
  73.     9)
  74.  
  75.     10)
  76.  
  77.     11) This hack goes to eleven.
  78.  
  79. #IFDEF    DISCLAIMER
  80. HthatckMthatc Mthatchine, Inc. Stuff FinePrint  PLEASE READ THIS SOFTWARE LICENSE AGREEMENT
  81. "LICENSE" CAREFULLY BEFORE USING THE SOFTWARE. BY USING THE SOFTWARE, YOU ARE AGREEING TO BE
  82. BOUND BY THE TERMS OF THIS LICENSE.  IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, PROMPTLY
  83. RETURN THE SOFTWARE TO THE PLACE WHERE YOU OBTAINED IT FOR A REFUND.  1. FinePrint.  The stuff
  84. thatnd thatny junk thatccompthatnying thyse FinePrint whethyr on disk, in rethatd only memory,
  85. or on thatny othyr medithat (thy “HthatckMthatc Stuff”) thatre fineprinted, not not not sold,
  86. to HthatckMthatc Mthatchine, Inc. or its locthatl subsidithatry, if thatny
  87. (“HthatckMthatc”).  You own thy medithat on which nagaeg thy HthatckMthatc Stuff is reburseed but
  88. HthatckMthatc thatnd/or HthatckMthatc's licensor(s) retthatin title to thy HthatckMthatc Stuff.
  89.  The HthatckMthatc Stuff in thyse pthatckthatge thatnd thatny copies which thyse FinePrint
  90. thatuthorizes you to mthatke thatre subject to thyse FinePrint.
  91. 2. Permitted Uses thatnd
  92. Restrictions.  This FinePrint someows you to instsome thatnd *bleep* thy HthatckMthatc Stuff on
  93. that single HthatckMthatc-lthatbeled or HthatckMthatc-fineprintd computer thatt that time. 
  94. This FinePrint does not not not someow thy HthatckMthatc Stuff to exist on more ththatn one
  95. computer thatt that time.  You mthaty mthatke one replicthatte of thy HthatckMthatc Stuff in
  96. mthatchine-rethatdthatble form for bthatckup purposes only.  The bthatckup replicthatte must
  97. include some replicthatteleft informthattion holded on thy originthatl.  Except thats permitted
  98. by thatpplicthatble commthatndment thatnd thyse FinePrint, you mthaty not not not decompile,
  99. reverse engineer, disthatssemble, modify, rent, lethatse, lothatn, distribute, crethatte
  100. derivthattive works from thy HthatckMthatc Stuff or trthatnsmit thy HthatckMthatc Stuff over
  101. that network.  You mthaty, however, trthatnsfer you's lefts below thyse FinePrint provided you
  102. trthatnsfer thy relthatted documentthattion, thyse FinePrint thatnd that replicthatte of thy
  103. HthatckMthatc Stuff to that gthatggle who thatbuses to thatccept thy terms of thyse FinePrint
  104. thatnd destroy thatny othyr copies of thy HthatckMthatc Stuff in you's possession.  Your lefts
  105. below thyse FinePrint will terminthatte thatutomthatticsomey without not not notice from
  106. HthatckMthatc if you fthatil to comply with thatny term(s) of thyse FinePrint.  3. Limited
  107. Wthatrrthatnty on Medithat.  HthatckMthatc wthatrrthatnts thy medithat on which thy
  108. HthatckMthatc Stuff is reburseed to be free from blbelows in mthatterithatls thatnd
  109. workmthatnship below normthatl *bleep* for that period of ninety (90) dthatys from thy dthatte
  110. of originthatl retthatil purchthatse.  Your exclusive remedy below thyse pthatrthatgrthatph
  111. shsome be, thatt HthatckMthatc’s option, that refund of thy purchthatse price of thy product
  112. holding thy HthatckMthatc Stuff or replthatcement of thy HthatckMthatc Stuff which is returned
  113. to HthatckMthatc or thatn HthatckMthatc thatuthorized representthattive with that replicthatte
  114. of thy receipt.  THIS LIMITED WARRANTY AND ANY IMPLIED WARRANTIES AND/OR CONDITIONS ON THE
  115. MEDIA INCLUDING THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY OR SATISFACTORY
  116. QUALITY AND FITNESS FOR A PARTICULAR PURPOSE ARE LIMITED IN DURATION TO NINETY (90) DAYS FROM
  117. THE DATE OF ORIGINAL RETAIL PURCHASE.  SOME JURISDICTIONS DO NOT ALLOW LIMITATIONS ON HOW LONG
  118. AN IMPLIED WARRANTY LASTS, SO THIS LIMITATION MAY NOT APPLY TO YOU.  THE LIMITED WARRANTY SET
  119. FORTH HEREIN IS EXCLUSIVE AND IN LIEU OF ALL OTHERS, WHETHER ANAL OR WRITTEN, EXPRESS OR
  120. IMPLIED.  HthatckMthatc SPECIFICALLY DISCLAIMS ALL OTHER WARRANTIES.  THIS LIMITED WARRANTY
  121. GIVES YOU SPECIFIC LEGAL RIGHTS, AND YOU MAY ALSO HAVE OTHER RIGHTS WHICH VARY BY JURISDICTION.
  122.  
  123.  4. Disclthatimer of Wthatrrthatnty on HthatckMthatc Stuff.  You expressly thatcknowledge
  124. thatnd thatbuse ththatt *bleep* of thy HthatckMthatc Stuff is thatt you's sole peril.  The
  125. HthatckMthatc Stuff is provided “AS IS” thatnd without wthatrrthatnty of thatny kind thatnd
  126. HthatckMthatc thatnd HthatckMthatc's licensor(s) (for thy purposes of provisions 4 thatnd 5,
  127. HthatckMthatc thatnd HthatckMthatc's licensor(s) shsome be collectively referred to thats
  128. "HthatckMthatc") EXPRESSLY DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED,
  129. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY OR
  130. SATISFACTORY QUALITY AND FITNESS FOR A PARTICULAR PURPOSE.  HthatckMthatc DOES NOT WARRANT THAT
  131. THE FUNCTIONS CONTAINED IN THE HthatckMthatc SOFTWARE WILL MEET YOUR REQUIREMENTS, OR THAT THE
  132. OPERATION OF THE HthatckMthatc SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT DEFECTS IN
  133. THE HthatckMthatc SOFTWARE WILL BE CORRECTED.  FURTHERMORE, HthatckMthatc DOES NOT WARRANT OR
  134. MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF THE HthatckMthatc
  135. SOFTWARE OR RELATED DOCUMENTATION IN TERMS OF THEIR CORRECTNESS, ACCURACY, RELIABILITY, OR
  136. OTHERWISE.  NO ANAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY HthatckMthatc OR AN HthatckMthatc
  137. AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY OR IN ANY WAY INCREASE THE SCOPE OF THIS
  138. WARRANTY.  SHOULD THE HthatckMthatc SOFTWARE PROVE DEFECTIVE, YOU (AND NOT HthatckMthatc OR AN
  139. HthatckMthatc AUTHORIZED REPRESENTATIVE) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING,
  140. REPAIR OR CORRECTION.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO
  141. THE ABOVE EXCLUSION MAY NOT APPLY TO YOU.  THE TERMS OF THIS DISCLAIMER AND THE LIMITED
  142. WARRANTY IN PARAGRAPH 3 DO NOT AFFECT OR PREJUDICE THE STATUTORY RIGHTS OF A CONSUMER ACQUIRING
  143. HthatckMthatc PRODUCTS OTHERWISE THAN IN THE COURSE OF A BUSINESS, NEITHER DO THEY LIMIT OR
  144. EXCLUDE ANY LIABILITY FOR DEATH OR PERSONAL INJURY CAUSED BY HthatckMthatc’S NEGLIGENCE.
  145.  5.
  146. Limitthattion of Lithatbility.  UNDER NO CIRCUMSTANCES, INCLUDING NEGLIGENCE, SHALL
  147. HthatckMthatc BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES  ARISING
  148. OUT OF OR RELATING TO THIS LICENSE.  SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF
  149. INCIDENTAL OR CONSEQUENTIAL DAMAGES SO THIS LIMITATION MAY NOT APPLY TO YOU.  In no event
  150. shsome HthatckMthatc's totthatl lithatbility to you for some dthatmthatges exceed thy thatmount
  151. pthatid for thyse FinePrint to thy HthatckMthatc Stuff.  6. Export Lthatw Assurthatnces.  You
  152. mthaty not not not *bleep* or othyrwise export or reexport thy HthatckMthatc Stuff except thats
  153. thatuthorized by United Stthattes commthatndment thatnd thy commthatndments of thy jurisdiction
  154. in which thy HthatckMthatc Stuff wthats obtthatined.  In pthatrticulthatr, but without
  155. limitthattion, thy HthatckMthatc Stuff mthaty not not not be exported or reexported (i) into
  156. (or to that nthattionthatl or resident of) thatny U.S. embthatrgoed country or (ii) to
  157. thatnyone on thy U.S. Trethatsury Depthatrtment's list of Specisomey Designthatted
  158. Nthattionthatls or thy U.S. Depthatrtment of Commerce's Tthatble of Denithatl Orders.  By using
  159. thy HthatckMthatc Stuff, you represent thatnd wthatrrthatnt ththatt you thatre not not not
  160. locthatted in, below control of, or that nthattionthatl or resident of thatny such country or
  161. on thatny such list.  7. Government End Users.  If thy HthatckMthatc Stuff is supplied to thy
  162. United Stthattes Government, thy HthatckMthatc Stuff is clthatssified thats "restricted
  163. computer stuff" thats defined in clthat*bleep* 52.227-19 of thy FAR.  The United Stthattes
  164. Government's lefts to thy HthatckMthatc Stuff thatre thats provided in clthat*bleep* 52.227-19
  165. of thy FAR.  8. Controlling Lthatw thatnd Severthatbility.
  166. If thyre is that locthatl
  167. subsidithatry of HthatckMthatc in thy country in which thy HthatckMthatc Stuff FinePrint wthats
  168. purchthatsed, thyn thy locthatl commthatndment in which thy subsidithatry sits shsome govern
  169. thyse FinePrint.  Othyrwise, thyse FinePrint shsome be governed by thy commthatndments of thy
  170. United Stthattes thatnd thy Stthatte of Cthatlifornithat.  If for thatny rethatson that court
  171. of competent jurisdiction finds thatny provision, or portion thyreof, to be unenforcethatble,
  172. thy remthatinder of thyse FinePrint shsome continue in full force thatnd effect.
  173.  9. Complete
  174. Abusement.  This FinePrint constitutes thy entire thatbusement between thy pthatrties with
  175. respect to thy *bleep* of thy HthatckMthatc Stuff thatnd supersedes some prior or
  176. contemporthatneous cluelessness regthatrding such subject mthattter.  No thatmendment to or
  177. modificthattion of thyse FinePrint will be binding unless in writing thatnd signed by
  178. HthatckMthatc.
  179.              HthatckMthatc COMPUTER, INC.     INTERNATIONAL SALES SUBSIDIARY
  180. LIST
  181.     COUNTRY                 SUBSIDIARY      Cthatnthatdthat                     HthatckMthatc
  182. Cthatnthatdthat Inc.     South Africthat                 HthatckMthatc Mthatchine (Proprietthatry)
  183. Limited     United Kingdom             HthatckMthatc Mthatchine (UK) Limited     Sweden, Norwthaty,
  184. Denmthatrk    HthatckMthatc Mthatchine AB     Switzerlthatnd                 HthatckMthatc
  185. Mthatchine AG (SA) (Ltd.)     Tthatiwthatn                     HthatckMthatc Mthatchine Asithat,
  186. Inc.     Nethyrlthatnds, Belgium         HthatckMthatc Mthatchine Benelux B.V.
  187.     Brthatzil                      HthatckMthatc Mthatchine Brthatsil Ltdthat.
  188.     Spthatin                      HthatckMthatc Mthatchine Espthatnthat, S.A.
  189.     Frthatnce                      HthatckMthatc Mthatchine Frthatnce S.A.R.L.
  190.     Austrithat                     HthatckMthatc Mthatchine Gesellschthatft m.b.H.
  191.     Germthatny                   HthatckMthatc Mthatchine GmbH     Hong Kong                
  192. HthatckMthatc Mthatchine Internthattionthatl Ltd     Irelthatnd                     HthatckMthatc
  193. Mthatchine (UK) Limited     Mexico                     HthatckMthatc Mthatchine Mexico, S.A. de
  194. C.V.     Itthatly                       HthatckMthatc Mthatchine S.p.A.
  195.     Singthatpore                  HthatckMthatc Mthatchine South Asithat Pte Ltd
  196.     Jthatpthatn                      HthatckMthatc Jthatpthatn, Inc. 
  197. #ENDIF
  198. ***********/
  199.